<if data="config('comment.enable') && post_commentable()">
	<div class="comment-container">
		<h2>评论</h2>
		<if data="IS_LOGINED || config('comment.anonymous.enable')">
			<form id="comment-form" action="{SITE_URL}mod.php?comment::add" method="post">
				<input type="hidden" name="post_id" value="{post_id()}" />
				<textarea name="comment_content" rows="3" required placeholder="在此发表你的看法..."></textarea>
				<div class="btn-group">
					<button class="btn" type="submit">发表</button>
					<button class="btn" type="reset">取消</button>
				</div>
				<if data="!IS_LOGINED">
					<div id="comment-anonymous">
						<div>
							<label for="user_nickname">昵称</label>
							<input type="text" name="user_nickname" id="user_nickname" placeholder="请输入昵称" required>
						</div>
						<div>
							<label for="user_email">邮箱</label>
							<input type="email" name="user_email" id="user_email" placeholder="请输入邮箱" required>
						</div>
						{!$verify = config('comment.anonymous.verify')}
						<if data="$verify">
							<div>
								<label for="vcode">验证码</label>
								<input type="text" name="vcode" id="vcode" placeholder="请输入验证码" required>
								<if data="$verify == 'vcode'">
									<img id="vcode-img" src="{ADMIN_URL}vcode.php" alt="验证码">
									<elseif data="$verify == 'email'">
										<button class="btn" id="mail-vcode">发送验证码</button>
									</elseif>
								</if>
							</div>
						</if>
					</div>
				</if>
			</form>
			<else>
				<p>请登录后再进行评论。</p>
			</else>
		</if>
		<div class="comment-list">
			<h3>评论历史({post_comments()})</h3>
			<while data="get_multi_comment(array('post_id'=>post_id(), 'limit'=>200))">
				<div class="comment" id="comment-id-{comment_id()}" data-id="{comment_id()}">
					<if data="comment_user('avatar')">
						<div class="comment-left">
							<img src="{get_user_avatar(64, comment_user('avatar'))}" alt="用户头像">
						</div>
					</if>
					<div class="comment-body">
						<h4 class="comment-heading">
							<span class="comment-author">{comment_user('nickname') ?: comment_user('name')}</span>
							<small>
								{date('Y-m-d H:i', comment_time())}
								<if data="me_id() != comment_user('id')">
									<a class="comment-reply" href="javascript:;">回复</a>
								</if>
							</small>
						</h4>
						<p class="comment-content">
							<if data="comment_parent()">
								<a class="comment-at" href="{url()}#comment-id-{comment_parent('id')}">
									@{comment_parent('user_nickname') ?: comment_parent('user_name')}
								</a>
							</if>
							<span class="comment-content">{comment_content()}</span>
						</p>
						<if data="comment_parent()">
							<blockquote>
								{comment_parent('user_nickname') ?: comment_parent('user_name')}: 
								{str_replace("\n", "<br>", comment_parent('comment_content'))}
							</blockquote>
						</if>
					</div>
				</div>
			</while>
		</div>
	</div>
</if>